package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.MallDrawActivityBase;
import com.sc.nft.entity.vo.draw.activity.MallDrawActivityBaseVO;
import com.sc.nft.mapper.MallDrawActivityBaseMapper;
import org.springframework.stereotype.Repository;

@Repository
public class MallDrawActivityBaseDao extends ServiceImpl<MallDrawActivityBaseMapper, MallDrawActivityBase> {

    public Page<MallDrawActivityBaseVO> page(Page toMp) {
        return page(toMp, new QueryWrapper<>());
    }
    
    public Page<MallDrawActivityBase> listEnabledActivity(Page page) {
        LambdaQueryWrapper<MallDrawActivityBase> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(MallDrawActivityBase::getEnabled, true);
        queryWrapper.orderByDesc(MallDrawActivityBase::getSortOrder);
        return page(page, queryWrapper);
    }
}
